<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<title>模块资源</title>
<head th:replace="system/inc/incHead :: incHead"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content no-padding no-margins">
    <div class="row no-padding no-margins">
        <div class="col-sm-3 no-padding no-margins">
            <div class="ibox no-margins">
                <div class="ibox-content" style="padding:8px 20px;">
                    <div class="row">
                        <div class="form-group no-padding no-margins">
                            <div class="input-group">
                                <span class="input-group-addon">部署系统:</span>
                                <select th:field="${sysSystem.id}" name="systemId" data-placeholder="请选择部署系统" class="chosen-select selectSystem"
                                        style="width:100%;">
                                    <option th:each="item:${systems}"
                                            th:value="${item.id}" hassubinfo="true"
                                            th:text="${item.systemName}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <th:block th:if="${not #lists.isEmpty(sysModels)}">
                    <div class="ibox-content m-t-md" layoutH="105">
                        <div class="file-manager">
                            <h5>系统模块</h5>
                            <div class="hr-line-dashed"></div>
                            <ul class="folder-list" style="padding: 0">
                                <li th:each="item:${sysModels}" class="p-xxs">
                                    <a th:if="${sysModel.id == item.id}" href="javascript:;"><i class="fa fa-cube"></i>
                                        <selection class="text-info">[[${item.modelSort}]]:[[${item.modelName}]]【[[${item.modelCode}]]】</selection>
                                    </a>
                                    <a th:if="${sysModel.id != item.id}" th:href="@{/sys/resource(sid=${sysSystem.id},mid=${item.id})}"><i
                                            class="fa fa-cube"></i>
                                        <selection>[[${item.modelSort}]]:[[${item.modelName}]]【[[${item.modelCode}]]】</selection>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </th:block>
            </div>
        </div>
        <div class="col-sm-9">
            <div th:if="${not #strings.isEmpty(sid) and not #strings.isEmpty(mid)}" class="row">
                <div class="col-sm-12">
                    <div class="ibox no-margins">
                        <div class="ibox-title no-borders">
                            <div class="btn btn-sm btn-info pull-left" type="button"
                                 th:ljUrl="@{/sys/resource/add(sid=${sid},mid=${mid},pid=0)}"
                                 title="添加模块资源"
                                 target="ljOpenCon">
                                <i class="fa fa-paste">添加资源</i>
                            </div>
                            <form id="pagerForm" action="/sys/resource" method="post">
                                <input type="hidden" id="sid" name="sid" th:value="${sid}"/>
                                <input type="hidden" id="mid" name="mid" th:value="${mid}"/>
                                <div class="form-group col-md-4 no-margins">
                                    <div class="input-group m-l-sm">
                                        <span class="input-group-addon">资源编号:</span>
                                        <input name="fid" type="number" class="form-control input-sm" maxlength="32" th:value="${fid}">
                                        <span class="input-group-addon btnPagerForm"><i class="fa fa-search"></i></span>
                                    </div>
                                </div>
                            </form>
                            <div class="btn btn-white btn-bitbucket btn-sm pull-right btnPageRefresh" type="button"><i
                                    class="fa fa-refresh">页面刷新</i></div>
                        </div>
                        <div class="ibox-content" style="padding:10px;" layoutH="65">
                            <table class="table table-striped table-bordered table-hover table-responsive lj-table-nowrap">
                                <thead>
                                <tr>
                                    <th style="min-width:60px;" class="text-center">编号</th>
                                    <th style="min-width:60px;" class="text-center">资源类型</th>
                                    <th style="min-width:200px;">资源名称</th>
                                    <th style="min-width:200px;max-width:200px;">资源地址</th>
                                    <th style="min-width:100px;">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <div th:include="sys/resource/child :: resourceChild" th:with="index=0,level=0,treeList=${sysResources}"></div>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="system/inc/incBottom :: incBottom"></div>
<script>
    jQuery(function ($) {
        $(".selectSystem").change(function () {
            window.location.href = "/sys/resource?sid=" + $(this).val();
        });
    });
</script>
</body>
</html>
